package com.common.boot.controller.system;
import com.common.boot.model.SysUser;
import com.common.boot.service.ISysUserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;

/**
 * 登录控制器
 */
@RestController
@RequestMapping("/login")
public class LoginController {
    @Resource
    private ISysUserService iSysUserService;

    /**
     * 登录
     * @param dto
     * @return
     */
    @PostMapping(value = "")
    public Map<String, Object> login(@RequestBody SysUser dto) {
        return iSysUserService.login(dto);
    }

    /**
     * 注册
     * @param dto
     * @return
     */
    @PostMapping("register")
    public Map<String, Object> register(@RequestBody SysUser dto){
        return iSysUserService.register(dto);
    }
}
